<?php
require_once 'config.php';

echo '<meta charset="utf-8">';
echo "<title>Cadastro</title>";

if (isset($_POST['enviar'])) {

	$crud['nome'] = $_POST['nome'];
	$crud['post'] = $_POST['post'];
	$crud['content'] = $_POST['content'];
	$crud['data'] = $_POST['data'];

	$query = "INSERT INTO informacao(nome, post, content, data)
			VALUES('$crud[nome]', '$crud[post]', '$crud[content]', '$crud[data]')";
	$cadastra = mysql_query($query);
		if ($cadastra) {
			echo "<br />";
			echo "Cadastrado com sucesso";
		}else{
			echo mysql_error();
		}
}else;


?>

<form name="cadastroForm" action="" method="post">
	<fieldset>
		<label>
			<span>Nome:</span><br />
			<input type="text" name="nome" value="">
		</label>

		<br />

		<label>
			<span>Post:</span><br />
			<input type="text" name="post" value="">
		</label>

		<br />

		<label>
			<span>Conteúdo:</span><br />
			<textarea name="content" rows="3"></textarea>
		</label>

		<br />

		<label>
			<span>Data:</span><br />
			<input type="text" name="data" value="<?php echo date('Y-m-d H:i:s'); ?>">
		</label>

		<br />

		<input type="submit" name="enviar" value="Cadastrar">
	</fieldset>
</form>